#include "comLogManager.h"
#include "MainFrameMgr.h"
#include "NewProjectDlg.h"
#include "ImportCMake.h"

#include "ttcodeStateChart.h"


void MainFrameMgr::m_menuItemNewFileOnMenuSelection( wxCommandEvent& event )
{
}
void MainFrameMgr::m_menuItemExitOnMenuSelection( wxCommandEvent& event )
{
	this->Close(true);
}
void MainFrameMgr::m_menuItemCreateNewWorkspaceOnMenuSelection( wxCommandEvent& event )
{
	NewProjectDlg dlg(this);
	int ret = dlg.ShowModal();
	if( wxID_OK == ret )
	{
		string name,home;
		dlg.genProject(name,home);
		ttcode_log << "name=<"<< name << ">" << endl;
		ttcode_log << "home=<"<< home << ">" << endl;
		eventNewProject st_evt;
		st_evt.name = name;
		st_evt.home = home;
		DisplayStateConfiguration(globalStateChart);
		globalStateChart.process_event( st_evt );
	}
}
void MainFrameMgr::m_menuItemSwitchWorkspaceOnMenuSelection( wxCommandEvent& event )
{
}



void MainFrameMgr::m_menuItemBuildNativeOnMenuSelection( wxCommandEvent& event )
{
	DisplayStateConfiguration(globalStateChart);
	eventBuild evt;
	evt.param = "--arch=native";
	globalStateChart.process_event( evt );
}
void MainFrameMgr::m_menuItemBuildPortableOnMenuSelection( wxCommandEvent& event )
{
	DisplayStateConfiguration(globalStateChart);
	eventBuild evt;
	evt.param = "--arch=portable";
	globalStateChart.process_event( evt );
}
void MainFrameMgr::m_menuItemBuildByteCodeOnlyOnMenuSelection( wxCommandEvent& event )
{
	DisplayStateConfiguration(globalStateChart);
	eventBuild evt;
	evt.param = "";
	globalStateChart.process_event( evt );
}
void MainFrameMgr::m_menuItemCleanAllOnMenuSelection( wxCommandEvent& event )
{
	DisplayStateConfiguration(globalStateChart);
	eventClean evt;
	evt.param = "all";
	globalStateChart.process_event( evt );
}
void MainFrameMgr::m_menuItemCleanCurrentOnMenuSelection( wxCommandEvent& event )
{
	DisplayStateConfiguration(globalStateChart);
	eventClean evt;
	globalStateChart.process_event( evt );
}

void MainFrameMgr::m_menuItemBuildCancelOnMenuSelection( wxCommandEvent& event )
{
	DisplayStateConfiguration(globalStateChart);
	eventCancel evt;
	globalStateChart.process_event( evt );
}




void MainFrameMgr::m_menuItemOpenFileOnMenuSelection( wxCommandEvent& event )
{
}
void MainFrameMgr::m_menuItemReloadFileOnMenuSelection( wxCommandEvent& event )
{
}
void MainFrameMgr::m_menuItemSaveOnMenuSelection( wxCommandEvent& event )
{
}
void MainFrameMgr::m_menuItemSaveAsOnMenuSelection( wxCommandEvent& event )
{
}
void MainFrameMgr::m_menuItemSaveAllFilesOnMenuSelection( wxCommandEvent& event )
{
}
void MainFrameMgr::m_menuItemCloseOnMenuSelection( wxCommandEvent& event )
{
}
void MainFrameMgr::m_menuItemCloseAllOnMenuSelection( wxCommandEvent& event )
{
}


void MainFrameMgr::m_menuItemCMakeOnMenuSelection( wxCommandEvent& event )
{
	ImportCMakeDlg dlg(this);
	int ret = dlg.ShowModal();
	if( wxID_OK == ret )
	{
	}
}
